﻿<?xml version="1.0" encoding="utf-8"?><Articles><Article><ArticlesID>812</ArticlesID><Title>Tạo box đọc tin RSS đơn giản với Javascript</Title><Body>&amp;lt;p&amp;gt;Vấn đề đọc tin RSS cũng nhiều, nhưng hầu hết l&amp;amp;agrave; d&amp;amp;ugrave;ng server control &amp;lt;br /&amp;gt;
&amp;lt;br /&amp;gt;
sau đ&amp;amp;acirc;y m&amp;amp;igrave;nh sẽ tr&amp;amp;igrave;nh b&amp;amp;agrave;y cho c&amp;amp;aacute;c bạn c&amp;amp;aacute;ch đọc RSS bằng &amp;lt;strong&amp;gt;Javascript &amp;lt;/strong&amp;gt;sử dụng &amp;lt;em&amp;gt;AjaxRequest&amp;lt;/em&amp;gt;&amp;lt;/p&amp;gt;
&amp;lt;p style=&amp;quot;text-align: center;&amp;quot;&amp;gt;&amp;lt;img width=&amp;quot;205&amp;quot; height=&amp;quot;341&amp;quot; src=&amp;quot;http://dev.meotom.net/Uploads/admin/2010/3/5/doc-tin-RSS-don-gian-voi-Javascript.gif&amp;quot; alt=&amp;quot;&amp;quot; /&amp;gt;&amp;lt;/p&amp;gt;
&amp;lt;p&amp;gt;đ&amp;amp;acirc;u ti&amp;amp;ecirc;n c&amp;amp;aacute;c bạn phải download &amp;lt;em&amp;gt;AjaxRequest &amp;lt;/em&amp;gt;về&amp;lt;/p&amp;gt;
&amp;lt;p&amp;gt;&amp;lt;a href=&amp;quot;http://blog.meotom.net/Library/AjaxRequest.js&amp;quot;&amp;gt;tại đ&amp;amp;acirc;y&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;
&amp;lt;p&amp;gt;(click chuột fai chọn Save As)&amp;lt;/p&amp;gt;
&amp;lt;p&amp;gt;sử dụng:&amp;lt;br /&amp;gt;
&amp;lt;br /&amp;gt;
khởi tạo 1 function đọc RSS&amp;lt;br /&amp;gt;
&amp;amp;nbsp;&amp;lt;/p&amp;gt;
&amp;lt;pre title=&amp;quot;code&amp;quot; class=&amp;quot;brush: jscript;&amp;quot;&amp;gt;
var RSS = {
    init: function(vUrl, vItem, divId) {
        AjaxRequest.get(
        {
            &amp;amp;quot;url&amp;amp;quot;: &amp;amp;quot;/Services/AjaxProxy.asp?sUrl=&amp;amp;quot; + vUrl
            , 'onLoading': function()
            { 
                //loading div here
            }
            , 'onSuccess': function(req) {
                //Request Success
            }
            , 'onError': function(req) {
                //Error handler
                //gmobj(vDivId).innerHTML = req.statusText;
            }
        });
    }
}&amp;lt;/pre&amp;gt;
&amp;lt;p&amp;gt;&amp;lt;br /&amp;gt;
&amp;lt;br /&amp;gt;
tại h&amp;amp;agrave;m init nhập v&amp;amp;agrave;o:&amp;lt;br /&amp;gt;
vUrl: đường link đến RSS&amp;lt;br /&amp;gt;
vItem: l&amp;amp;agrave; số tin RSS được hiển thị&amp;lt;br /&amp;gt;
divId: ID của thẻ div &amp;lt;br /&amp;gt;
&amp;lt;br /&amp;gt;
tiếp theo để đọc RSS từ trang kh&amp;amp;aacute;c bằng Ajax (vd: &amp;lt;em&amp;gt;http://vnexpress.net/RSS/GL/trang-chu.rss&amp;lt;/em&amp;gt;) th&amp;amp;igrave; c&amp;amp;aacute;c bạn cần c&amp;amp;oacute; 1 file để &amp;lt;a href=&amp;quot;http://dev.meotom.net/2010/1/4/HttpRequest-ASP-Classic-2BF.htm&amp;quot; target=&amp;quot;_blank&amp;quot;&amp;gt;lấy nội dung của file RSS về&amp;lt;/a&amp;gt; ở đ&amp;amp;acirc;y ta tạm gọi c&amp;amp;oacute; l&amp;amp;agrave; Proxy (&amp;lt;em&amp;gt;Ajax Cross Domain&amp;lt;/em&amp;gt;)&amp;lt;br /&amp;gt;
&amp;lt;br /&amp;gt;
File AjaxProxy.asp c&amp;amp;oacute; nội dung như sau:&amp;lt;br /&amp;gt;
&amp;amp;nbsp;&amp;lt;/p&amp;gt;
&amp;lt;pre title=&amp;quot;code&amp;quot; class=&amp;quot;brush: vb;&amp;quot;&amp;gt;
&amp;amp;lt;%@LANGUAGE=&amp;amp;quot;VBSCRIPT&amp;amp;quot; CODEPAGE=&amp;amp;quot;65001&amp;amp;quot;%&amp;amp;gt;
&amp;amp;lt;%
    If Not Request.QueryString(&amp;amp;quot;sUrl&amp;amp;quot;) = &amp;amp;quot;&amp;amp;quot; Then
        Session.CodePage = 65001
        Dim objXmlHttp
        Dim strHTML
        Set objXmlHttp = Server.CreateObject(&amp;amp;quot;Msxml2.ServerXMLHTTP&amp;amp;quot;)
        objXmlHttp.open &amp;amp;quot;GET&amp;amp;quot;, Request.QueryString(&amp;amp;quot;sUrl&amp;amp;quot;), False
        objXmlHttp.send
        strHTML = objXmlHttp.responseText
        Set objXmlHttp = Nothing
        Response.ContentType = &amp;amp;quot;application/xhtml+xml&amp;amp;quot;
        Response.Write(strHTML)
    End If
%&amp;amp;gt;&amp;lt;/pre&amp;gt;
&amp;lt;p&amp;gt;&amp;lt;br /&amp;gt;
&amp;lt;br /&amp;gt;
file n&amp;amp;agrave;y sẽ nhận Url từ query string lấy từ h&amp;amp;agrave;m &amp;lt;em&amp;gt;AjaxRequest &amp;lt;/em&amp;gt;b&amp;amp;ecirc;n tr&amp;amp;ecirc;n sau đ&amp;amp;oacute; sẽ trả về (response) dạng XML&amp;lt;br /&amp;gt;
&amp;lt;br /&amp;gt;
khai th&amp;amp;aacute;c file RSS&amp;lt;br /&amp;gt;
&amp;lt;br /&amp;gt;
trong h&amp;amp;agrave;m &amp;lt;strong&amp;gt;OnSuccess &amp;lt;/strong&amp;gt;của &amp;lt;em&amp;gt;AjaxRequest &amp;lt;/em&amp;gt;c&amp;amp;aacute;c bạn viết như sau:&amp;lt;br /&amp;gt;
&amp;amp;nbsp;&amp;lt;/p&amp;gt;
&amp;lt;pre title=&amp;quot;code&amp;quot; class=&amp;quot;brush: jscript;&amp;quot;&amp;gt;
var strOut = &amp;amp;quot;&amp;amp;quot;;
var TotalItem = 0;
strContent = req.responseXML;

strOut += &amp;amp;quot;&amp;amp;lt;div class=\&amp;amp;quot;mtAd_____otherBox\&amp;amp;quot;&amp;amp;gt;&amp;amp;quot;;
strOut += &amp;amp;quot; &amp;amp;lt;div class=\&amp;amp;quot;mtAd_____headerBox\&amp;amp;quot;&amp;amp;gt;RSS Reader&amp;amp;lt;/a&amp;amp;gt;&amp;amp;lt;/div&amp;amp;gt;&amp;amp;quot;;
strOut += &amp;amp;quot; &amp;amp;lt;div class=\&amp;amp;quot;mtAd_____contentBox\&amp;amp;quot; id=\&amp;amp;quot;mtAd_____mtRSS\&amp;amp;quot;&amp;amp;gt;&amp;amp;quot;;
strOut += &amp;amp;quot;     &amp;amp;lt;table cellpadding=\&amp;amp;quot;4\&amp;amp;quot; cellspacing=\&amp;amp;quot;6\&amp;amp;quot; border=\&amp;amp;quot;0\&amp;amp;quot; width=\&amp;amp;quot;100%\&amp;amp;quot; class=\&amp;amp;quot;mtAd_____tblDashboard\&amp;amp;quot;&amp;amp;gt;&amp;amp;quot;;
for (i = 0; i &amp;amp;lt;= vItem; i++) {
    //lay title
    title = getNodeValue(strContent.getElementsByTagName('item').item(i).getElementsByTagName('title'));
    //lay link
    link = getNodeValue(strContent.getElementsByTagName('item').item(i).getElementsByTagName('link'));
    //lay ngay post
    postdate = getNodeValue(strContent.getElementsByTagName('item').item(i).getElementsByTagName('pubDate'));

    strOut += &amp;amp;quot;     &amp;amp;lt;tr&amp;amp;gt;&amp;amp;quot;;
    strOut += &amp;amp;quot;         &amp;amp;lt;td&amp;amp;gt;&amp;amp;lt;a target=\&amp;amp;quot;blank\&amp;amp;quot; href=\&amp;amp;quot;&amp;amp;quot;.concat(link).concat(&amp;amp;quot;\&amp;amp;quot; title=\&amp;amp;quot;&amp;amp;quot;).concat(title).concat(&amp;amp;quot;\&amp;amp;quot;&amp;amp;gt;&amp;amp;quot;).concat(title).concat(&amp;amp;quot;&amp;amp;lt;/a&amp;amp;gt;&amp;amp;lt;span class=\&amp;amp;quot;mtAd_____lblPostDate\&amp;amp;quot;&amp;amp;gt; - &amp;amp;quot;).concat(dateFormat(postdate, &amp;amp;quot;isoDate&amp;amp;quot;)).concat(&amp;amp;quot;&amp;amp;lt;/span&amp;amp;gt;&amp;amp;lt;/td&amp;amp;gt;&amp;amp;quot;);
    strOut += &amp;amp;quot;     &amp;amp;lt;/tr&amp;amp;gt;&amp;amp;quot;;
}
strOut += &amp;amp;quot;     &amp;amp;lt;/table&amp;amp;gt;&amp;amp;quot;;
strOut += &amp;amp;quot; &amp;amp;lt;/div&amp;amp;gt;&amp;amp;quot;;
strOut += &amp;amp;quot;&amp;amp;lt;/div&amp;amp;gt;&amp;amp;quot;;
gmobj(divId).innerHTML = strOut;&amp;lt;/pre&amp;gt;
&amp;lt;p&amp;gt;&amp;lt;br /&amp;gt;
&amp;lt;br /&amp;gt;
bạn cần h&amp;amp;agrave;m &amp;lt;strong&amp;gt;getNodeValue &amp;lt;/strong&amp;gt;để lấy nội dung của từng thẻ về&amp;lt;br /&amp;gt;
&amp;amp;nbsp;&amp;lt;/p&amp;gt;
&amp;lt;pre title=&amp;quot;code&amp;quot; class=&amp;quot;brush: jscript;&amp;quot;&amp;gt;
function getNodeValue(o) {
    try {
        return o.item(0).firstChild.nodeValue;
    }
    catch (err) {
        return '';
    }
}&amp;lt;/pre&amp;gt;
&amp;lt;p&amp;gt;&amp;lt;br /&amp;gt;
&amp;lt;br /&amp;gt;
bạn cũng cần 1 h&amp;amp;agrave;m lấy &amp;lt;strong&amp;gt;document.getElementById&amp;lt;/strong&amp;gt; nhanh &amp;lt;br /&amp;gt;
ở đ&amp;amp;acirc;y của m&amp;amp;igrave;nh l&amp;amp;agrave; h&amp;amp;agrave;m &amp;lt;strong&amp;gt;gmobj&amp;lt;/strong&amp;gt;&amp;lt;br /&amp;gt;
&amp;amp;nbsp;&amp;lt;/p&amp;gt;
&amp;lt;pre title=&amp;quot;code&amp;quot; class=&amp;quot;brush: jscript;&amp;quot;&amp;gt;
function gmobj(mtxt) { if (document.getElementById) { m = document.getElementById(mtxt) } else if (document.all) { m = document.all[mtxt] } else if (document.layers) { m = document[mtxt] } return m; }&amp;lt;/pre&amp;gt;
&amp;lt;p&amp;gt;&amp;lt;br /&amp;gt;
&amp;lt;br /&amp;gt;
tiếp theo l&amp;amp;agrave; 1 h&amp;amp;agrave;m format datetime&amp;lt;br /&amp;gt;
&amp;amp;nbsp;&amp;lt;/p&amp;gt;
&amp;lt;pre title=&amp;quot;code&amp;quot; class=&amp;quot;brush: jscript;&amp;quot;&amp;gt;
var dateFormat = function() {
    var token = /d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|&amp;amp;quot;[^&amp;amp;quot;]*&amp;amp;quot;|'[^']*'/g,
        timezone = /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,
        timezoneClip = /[^-+\dA-Z]/g,
        pad = function(val, len) {
            val = String(val);
            len = len || 2;
            while (val.length &amp;amp;lt; len) val = &amp;amp;quot;0&amp;amp;quot; + val;
            return val;
        };

    // Regexes and supporting functions are cached through closure
    return function(date, mask, utc) {
        var dF = dateFormat;

        // You can't provide utc if you skip other args (use the &amp;amp;quot;UTC:&amp;amp;quot; mask prefix)
        if (arguments.length == 1 &amp;amp;amp;&amp;amp;amp; (typeof date == &amp;amp;quot;string&amp;amp;quot; || date instanceof String) &amp;amp;amp;&amp;amp;amp; !/\d/.test(date)) {
            mask = date;
            date = undefined;
        }

        // Passing date through Date applies Date.parse, if necessary
        date = date ? new Date(date) : new Date();
        if (isNaN(date)) throw new SyntaxError(&amp;amp;quot;invalid date&amp;amp;quot;);

        mask = String(dF.masks[mask] || mask || dF.masks[&amp;amp;quot;default&amp;amp;quot;]);

        // Allow setting the utc argument via the mask
        if (mask.slice(0, 4) == &amp;amp;quot;UTC:&amp;amp;quot;) {
            mask = mask.slice(4);
            utc = true;
        }

        var _ = utc ? &amp;amp;quot;getUTC&amp;amp;quot; : &amp;amp;quot;get&amp;amp;quot;,
            d = date[_ + &amp;amp;quot;Date&amp;amp;quot;](),
            D = date[_ + &amp;amp;quot;Day&amp;amp;quot;](),
            m = date[_ + &amp;amp;quot;Month&amp;amp;quot;](),
            y = date[_ + &amp;amp;quot;FullYear&amp;amp;quot;](),
            H = date[_ + &amp;amp;quot;Hours&amp;amp;quot;](),
            M = date[_ + &amp;amp;quot;Minutes&amp;amp;quot;](),
            s = date[_ + &amp;amp;quot;Seconds&amp;amp;quot;](),
            L = date[_ + &amp;amp;quot;Milliseconds&amp;amp;quot;](),
            o = utc ? 0 : date.getTimezoneOffset(),
            flags = {
                d: d,
                dd: pad(d),
                ddd: dF.i18n.dayNames[D],
                dddd: dF.i18n.dayNames[D + 7],
                m: m + 1,
                mm: pad(m + 1),
                mmm: dF.i18n.monthNames[m],
                mmmm: dF.i18n.monthNames[m + 12],
                yy: String(y).slice(2),
                yyyy: y,
                h: H % 12 || 12,
                hh: pad(H % 12 || 12),
                H: H,
                HH: pad(H),
                M: M,
                MM: pad(M),
                s: s,
                ss: pad(s),
                l: pad(L, 3),
                L: pad(L &amp;amp;gt; 99 ? Math.round(L / 10) : L),
                t: H &amp;amp;lt; 12 ? &amp;amp;quot;a&amp;amp;quot; : &amp;amp;quot;p&amp;amp;quot;,
                tt: H &amp;amp;lt; 12 ? &amp;amp;quot;am&amp;amp;quot; : &amp;amp;quot;pm&amp;amp;quot;,
                T: H &amp;amp;lt; 12 ? &amp;amp;quot;A&amp;amp;quot; : &amp;amp;quot;P&amp;amp;quot;,
                TT: H &amp;amp;lt; 12 ? &amp;amp;quot;AM&amp;amp;quot; : &amp;amp;quot;PM&amp;amp;quot;,
                Z: utc ? &amp;amp;quot;UTC&amp;amp;quot; : (String(date).match(timezone) || [&amp;amp;quot;&amp;amp;quot;]).pop().replace(timezoneClip, &amp;amp;quot;&amp;amp;quot;),
                o: (o &amp;amp;gt; 0 ? &amp;amp;quot;-&amp;amp;quot; : &amp;amp;quot;+&amp;amp;quot;) + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4),
                S: [&amp;amp;quot;th&amp;amp;quot;, &amp;amp;quot;st&amp;amp;quot;, &amp;amp;quot;nd&amp;amp;quot;, &amp;amp;quot;rd&amp;amp;quot;][d % 10 &amp;amp;gt; 3 ? 0 : (d % 100 - d % 10 != 10) * d % 10]
            };

        return mask.replace(token, function($0) {
            return $0 in flags ? flags[$0] : $0.slice(1, $0.length - 1);
        });
    };
} ();

// Some common format strings
dateFormat.masks = {
    &amp;amp;quot;default&amp;amp;quot;: &amp;amp;quot;ddd mmm dd yyyy HH:MM:ss&amp;amp;quot;,
    shortDate: &amp;amp;quot;m/d/yy&amp;amp;quot;,
    mediumDate: &amp;amp;quot;mmm d, yyyy&amp;amp;quot;,
    longDate: &amp;amp;quot;mmmm d, yyyy&amp;amp;quot;,
    fullDate: &amp;amp;quot;dddd, mmmm d, yyyy&amp;amp;quot;,
    shortTime: &amp;amp;quot;h:MM TT&amp;amp;quot;,
    mediumTime: &amp;amp;quot;h:MM:ss TT&amp;amp;quot;,
    longTime: &amp;amp;quot;h:MM:ss TT Z&amp;amp;quot;,
    isoDate: &amp;amp;quot;yyyy-mm-dd&amp;amp;quot;,
    isoTime: &amp;amp;quot;HH:MM:ss&amp;amp;quot;,
    isoDateTime: &amp;amp;quot;yyyy-mm-dd'T'HH:MM:ss&amp;amp;quot;,
    isoUtcDateTime: &amp;amp;quot;UTC:yyyy-mm-dd'T'HH:MM:ss'Z'&amp;amp;quot;
};

// Internationalization strings
dateFormat.i18n = {
    dayNames: [
        &amp;amp;quot;Sun&amp;amp;quot;, &amp;amp;quot;Mon&amp;amp;quot;, &amp;amp;quot;Tue&amp;amp;quot;, &amp;amp;quot;Wed&amp;amp;quot;, &amp;amp;quot;Thu&amp;amp;quot;, &amp;amp;quot;Fri&amp;amp;quot;, &amp;amp;quot;Sat&amp;amp;quot;,
        &amp;amp;quot;Sunday&amp;amp;quot;, &amp;amp;quot;Monday&amp;amp;quot;, &amp;amp;quot;Tuesday&amp;amp;quot;, &amp;amp;quot;Wednesday&amp;amp;quot;, &amp;amp;quot;Thursday&amp;amp;quot;, &amp;amp;quot;Friday&amp;amp;quot;, &amp;amp;quot;Saturday&amp;amp;quot;
    ],
    monthNames: [
        &amp;amp;quot;Jan&amp;amp;quot;, &amp;amp;quot;Feb&amp;amp;quot;, &amp;amp;quot;Mar&amp;amp;quot;, &amp;amp;quot;Apr&amp;amp;quot;, &amp;amp;quot;May&amp;amp;quot;, &amp;amp;quot;Jun&amp;amp;quot;, &amp;amp;quot;Jul&amp;amp;quot;, &amp;amp;quot;Aug&amp;amp;quot;, &amp;amp;quot;Sep&amp;amp;quot;, &amp;amp;quot;Oct&amp;amp;quot;, &amp;amp;quot;Nov&amp;amp;quot;, &amp;amp;quot;Dec&amp;amp;quot;,
        &amp;amp;quot;January&amp;amp;quot;, &amp;amp;quot;February&amp;amp;quot;, &amp;amp;quot;March&amp;amp;quot;, &amp;amp;quot;April&amp;amp;quot;, &amp;amp;quot;May&amp;amp;quot;, &amp;amp;quot;June&amp;amp;quot;, &amp;amp;quot;July&amp;amp;quot;, &amp;amp;quot;August&amp;amp;quot;, &amp;amp;quot;September&amp;amp;quot;, &amp;amp;quot;October&amp;amp;quot;, &amp;amp;quot;November&amp;amp;quot;, &amp;amp;quot;December&amp;amp;quot;
    ]
};

// For convenience...
Date.prototype.format = function(mask, utc) {
    return dateFormat(this, mask, utc);
};&amp;lt;/pre&amp;gt;
&amp;lt;p&amp;gt;&amp;lt;br /&amp;gt;
&amp;lt;br /&amp;gt;
như vậy l&amp;amp;agrave; ch&amp;amp;uacute;ng ta đ&amp;amp;atilde; ho&amp;amp;agrave;n th&amp;amp;agrave;nh đoạn code đọc RSS đơn giản từ bất kỳ trang n&amp;amp;agrave;o&amp;lt;br /&amp;gt;
&amp;amp;nbsp;&amp;lt;/p&amp;gt;
&amp;lt;pre title=&amp;quot;code&amp;quot; class=&amp;quot;brush: jscript;&amp;quot;&amp;gt;
var title = &amp;amp;quot;&amp;amp;quot;;
var link = &amp;amp;quot;&amp;amp;quot;;
var postdate = &amp;amp;quot;&amp;amp;quot;;
var strContent = &amp;amp;quot;&amp;amp;quot;;

var RSS = {
    init: function(vUrl, vItem, SiteName, SiteUrl, divId) {
        AjaxRequest.get(
        {
            &amp;amp;quot;url&amp;amp;quot;: &amp;amp;quot;/Services/AjaxProxy.ashx?sUrl=&amp;amp;quot; + vUrl
            , 'onLoading': function() { gmobj(divId).innerHTML = &amp;amp;quot;&amp;amp;lt;div class=\&amp;amp;quot;mtAd_____loadingDiv\&amp;amp;quot;&amp;amp;gt;Loading ...&amp;amp;lt;/div&amp;amp;gt;&amp;amp;quot;; }
            , 'onSuccess': function(req) {
                var strOut = &amp;amp;quot;&amp;amp;quot;;
                var TotalItem = 0;
                strContent = req.responseXML;
                TotalItem = req.responseXML.getElementsByTagName('item').length;
                //alert(TotalItem);
                if (vItem &amp;amp;gt; TotalItem) {
                    vItem = TotalItem;
                }
                if (vItem &amp;amp;lt;= 0) {
                    vItem = 5
                }               

                strOut += &amp;amp;quot;&amp;amp;lt;div class=\&amp;amp;quot;mtAd_____otherBox\&amp;amp;quot;&amp;amp;gt;&amp;amp;quot;;
                strOut += &amp;amp;quot; &amp;amp;lt;div class=\&amp;amp;quot;mtAd_____headerBox\&amp;amp;quot;&amp;amp;gt;&amp;amp;lt;a href=\&amp;amp;quot;&amp;amp;quot; + SiteUrl + &amp;amp;quot;\&amp;amp;quot; target=\&amp;amp;quot;blank\&amp;amp;quot;&amp;amp;gt;Quảng c&amp;amp;aacute;o bởi &amp;amp;quot; + SiteName + &amp;amp;quot;&amp;amp;lt;/a&amp;amp;gt;&amp;amp;lt;/div&amp;amp;gt;&amp;amp;quot;;
                strOut += &amp;amp;quot; &amp;amp;lt;div class=\&amp;amp;quot;mtAd_____contentBox\&amp;amp;quot; id=\&amp;amp;quot;mtAd_____mtRSS\&amp;amp;quot;&amp;amp;gt;&amp;amp;quot;;
                strOut += &amp;amp;quot;     &amp;amp;lt;table cellpadding=\&amp;amp;quot;4\&amp;amp;quot; cellspacing=\&amp;amp;quot;6\&amp;amp;quot; border=\&amp;amp;quot;0\&amp;amp;quot; width=\&amp;amp;quot;100%\&amp;amp;quot; class=\&amp;amp;quot;mtAd_____tblDashboard\&amp;amp;quot;&amp;amp;gt;&amp;amp;quot;;
                for (i = 0; i &amp;amp;lt;= vItem-1; i++) {
                    title = getNodeValue(strContent.getElementsByTagName('item').item(i).getElementsByTagName('title'));
                    link = getNodeValue(strContent.getElementsByTagName('item').item(i).getElementsByTagName('link'));
                    postdate = getNodeValue(strContent.getElementsByTagName('item').item(i).getElementsByTagName('pubDate'));

                    strOut += &amp;amp;quot;     &amp;amp;lt;tr&amp;amp;gt;&amp;amp;quot;;
                    strOut += &amp;amp;quot;         &amp;amp;lt;td&amp;amp;gt;&amp;amp;lt;a target=\&amp;amp;quot;blank\&amp;amp;quot; href=\&amp;amp;quot;&amp;amp;quot;.concat(link).concat(&amp;amp;quot;\&amp;amp;quot; title=\&amp;amp;quot;&amp;amp;quot;).concat(title).concat(&amp;amp;quot;\&amp;amp;quot;&amp;amp;gt;&amp;amp;quot;).concat(title).concat(&amp;amp;quot;&amp;amp;lt;/a&amp;amp;gt;&amp;amp;lt;span class=\&amp;amp;quot;mtAd_____lblPostDate\&amp;amp;quot;&amp;amp;gt; - &amp;amp;quot;).concat(dateFormat(postdate, &amp;amp;quot;isoDate&amp;amp;quot;)).concat(&amp;amp;quot;&amp;amp;lt;/span&amp;amp;gt;&amp;amp;lt;/td&amp;amp;gt;&amp;amp;quot;);
                    strOut += &amp;amp;quot;     &amp;amp;lt;/tr&amp;amp;gt;&amp;amp;quot;;
                }
                strOut += &amp;amp;quot;     &amp;amp;lt;/table&amp;amp;gt;&amp;amp;quot;;
                strOut += &amp;amp;quot; &amp;amp;lt;/div&amp;amp;gt;&amp;amp;quot;;
                strOut += &amp;amp;quot;&amp;amp;lt;/div&amp;amp;gt;&amp;amp;quot;;
                gmobj(divId).innerHTML = strOut;
            }
            , 'onError': function(req) {
                //gmobj(vDivId).innerHTML = req.statusText;
            }
        });
    }
}&amp;lt;/pre&amp;gt;
&amp;lt;p&amp;gt;&amp;lt;br /&amp;gt;
&amp;lt;br /&amp;gt;
sau khi viết xong h&amp;amp;agrave;m ch&amp;amp;uacute;ng ta ra ngo&amp;amp;agrave;i trang default.htm, trong thẻ body gọi&amp;lt;br /&amp;gt;
&amp;amp;nbsp;&amp;lt;/p&amp;gt;
&amp;lt;pre title=&amp;quot;code&amp;quot; class=&amp;quot;brush: xhtml;&amp;quot;&amp;gt;
&amp;amp;lt;div id=&amp;amp;quot;divAd&amp;amp;quot;&amp;amp;gt;&amp;amp;lt;/div&amp;amp;gt;
&amp;amp;lt;script language=&amp;amp;quot;javascript&amp;amp;quot; type=&amp;amp;quot;text/javascript&amp;amp;quot;&amp;amp;gt;
    window.onload = RSS.init(&amp;amp;quot;http://blog.meotom.net/Resource/RSS/Trang-Chu.xml&amp;amp;quot;, 5, &amp;amp;quot;MeoTom.Net&amp;amp;quot;, &amp;amp;quot;http://meotom.net&amp;amp;quot;, &amp;amp;quot;divAd&amp;amp;quot;);
&amp;amp;lt;/script&amp;amp;gt;&amp;lt;/pre&amp;gt;
&amp;lt;p&amp;gt;&amp;lt;br /&amp;gt;
&amp;lt;br /&amp;gt;
Xem demo &amp;lt;a href=&amp;quot;http://demo.meotom.net/RssReader.htm&amp;quot; target=&amp;quot;_blank&amp;quot;&amp;gt;tại đ&amp;amp;acirc;y&amp;lt;/a&amp;gt; &amp;lt;br /&amp;gt;
&amp;lt;br /&amp;gt;
&amp;lt;a href=&amp;quot;http://blog.meotom.net/Library/AjaxRequest.js&amp;quot; target=&amp;quot;_blank&amp;quot;&amp;gt;download file AjaxRequest&amp;lt;/a&amp;gt;&amp;lt;br /&amp;gt;
&amp;lt;a target=&amp;quot;_blank&amp;quot; href=&amp;quot;http://dev.meotom.net/Uploads/admin/2010/3/5/AjaxProxy.zip&amp;quot;&amp;gt;download file AjaxProxy.asp&amp;lt;/a&amp;gt;&amp;lt;br /&amp;gt;
&amp;lt;a target=&amp;quot;_blank&amp;quot; href=&amp;quot;http://demo.meotom.net/js/LibAd.js&amp;quot;&amp;gt;download file javascript source&amp;lt;/a&amp;gt;&amp;lt;br /&amp;gt;
&amp;lt;a target=&amp;quot;_blank&amp;quot; href=&amp;quot;http://demo.meotom.net/css/adStyle.css&amp;quot;&amp;gt;download file style (css)&amp;lt;/a&amp;gt;&amp;lt;br /&amp;gt;
&amp;lt;br /&amp;gt;
&amp;amp;nbsp;&amp;lt;/p&amp;gt;</Body><CommentEnabled>True</CommentEnabled><ViewCount>0</ViewCount><ReleaseDate>3/5/2010 1:15:54 AM</ReleaseDate><TotalComment>0</TotalComment><IsMedia>False</IsMedia><IsPicture>False</IsPicture><IsVote>True</IsVote><ArticlePassword /><PostVisible>0</PostVisible><ArticlePath>/2010/3/5/Tao-box-doc-tin-RSS-don-gian-voi-Javascript-32C</ArticlePath><Approved>True</Approved><ImagePath /><CategoryId>30</CategoryId><ArrayCatID>30|25</ArrayCatID></Article></Articles>